package com.fpt.edu.vn.h2tv.dao.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * TbCategory entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "tb_category", catalog = "bookdb")
public class TbCategory implements java.io.Serializable {

	// Fields

	private Short categoryId;
	private String categoryName;
	private List<TbBookCategory> tbBookCategories = new ArrayList<TbBookCategory>(
			0);

	// Constructors

	/** default constructor */
	public TbCategory() {
	}

	/** minimal constructor */
	public TbCategory(Short categoryId, String categoryName) {
		this.categoryId = categoryId;
		this.categoryName = categoryName;
	}

	/** full constructor */
	public TbCategory(Short categoryid, String category,
			List<TbBookCategory> tbBookCategories) {
		this.categoryId = categoryid;
		this.categoryName = category;
		this.tbBookCategories = tbBookCategories;
	}

	// Property accessors
	@Id
	@Column(name = "CATEGORYID", unique = true, nullable = false)
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Short getCategoryId() {
		return this.categoryId;
	}

	public void setCategoryId(Short categoryId) {
		this.categoryId = categoryId;
	}

	@Column(name = "CATEGORY", nullable = false)
	public String getCategoryName() {
		return this.categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbCategory")
	public List<TbBookCategory> getTbBookCategories() {
		return this.tbBookCategories;
	}

	public void setTbBookCategories(List<TbBookCategory> tbBookCategories) {
		this.tbBookCategories = tbBookCategories;
	}

}